﻿//
// IRepositoryContract.cs
//
// Authors:
//    Claus Jørgensen <10229@iha.dk>
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Diagnostics.Contracts;

namespace RSD.Data.Contracts
{
    /// <summary>
    /// IRepository code contract.
    /// </summary>
    [ContractClassFor(typeof(IRepository<>))]
    internal abstract class IRepositoryContract<T> : IRepository<T>
        where T : class
    {
        #region IRepository<T> Members

        public IEnumerable<T> FindAll()
        {
            Contract.Ensures(Contract.Result<IEnumerable<T>>() != null);

            return default(IEnumerable<T>);
        }

        public IEnumerable<T> FindBy(Expression<Func<T, bool>> predicate)
        {
            Contract.Requires(predicate != null);
            Contract.Ensures(Contract.Result<IEnumerable<T>>() != null);

            return default(IEnumerable<T>);
        }

        public IRepository<T> Add(T entity)
        {
            Contract.Requires(entity != null);

            return default(IRepository<T>);
        }

        public IRepository<T> Remove(T entity)
        {
            Contract.Requires(entity != null);
            
            return default(IRepository<T>);
        }

        public IRepository<T> SaveChanges()
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
